package edu.ccut.saturn.manager.bundles.core;

import org.osgi.framework.Bundle;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.core.ServiceFactory;

public class UpLoadBundle extends DefaultComponent {
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {
		String file = (String) parameterContext.getParameterValue(0);
		if (file != null && !"".equals(file)) {
			file = "file:" + file;	
			
				Bundle bundle = ServiceFactory.getBundleService().getBundleContext().installBundle(file);
				bundle.start();		
			/*Bundle[] bundles = activator.getBundleContext().getBundles();
			for (Bundle bundle : bundles) {
				if (bundle.getLocation().equals(file)) {
					bundle.start();
					break;
				}
			}*/
		}
	}
}